//定义全局使用的webSocket
import { Message } from 'element-ui'

// const wsUri = "ws://192.168.20.76:9905/webSocket/"+sessionStorage.getItem('ucId');
let wsUri = "wss://ifire.uchung.com/wss/webSocket/"

let websocket;
let tt;
let lockReconnect = false;//避免重复连接

var webSocket = {
    init(val){
        if ("WebSocket" in window) {
            websocket = new WebSocket(wsUri + val);
        } else {
            console.log("您的浏览器不支持 WebSocket!");
            return;
        }

        websocket.onmessage=function (e){
            let obj = JSON.parse(e.data);
            console.log(obj)
        }

        websocket.onclose =function (){
            console.log("链接已关闭");
        }



    }
}